* SPSS Syntax for data manipulation of Module 2 data.

* Creates the following variables:

Region - N, S and Centre
Poverty - poverty score, not grouped
Povcode - 7 poverty categories (not used for the analysis)
Povcode1 - poverty categories used for the analysis 
Chitukuk - number of weeks people are willing to work for one starter pack
Housing1 - type of housing

Note:
There is no need to run this programme again, all the variables are stored in the 
data set

***********************************************************************************************

if ( addcode = 1) region = 1.
if ( addcode = 2) region = 1.
if ( addcode = 3) region = 2.
if ( addcode = 4) region = 2.
if ( addcode = 5) region = 2.
if ( addcode = 6) region = 3.
if ( addcode = 7) region = 3.
if ( addcode = 8) region = 3.

variable labels region "Region".

value labels region
1 North
2 Centre
3 South.

compute poverty = chicken*2 + goats * 10 + cattle * 100.

RECODE
  poverty
  (0 thru 1=1)  (2 thru 9=2)  (9 thru 19=3)  (20 thru 40=4)  (41 thru 99=5)
 (100 thru 400=6)  (400 thru Highest=7)  INTO  povcode .
VARIABLE LABELS povcode 'Poverty code'.
EXECUTE .
FREQUENCIES
  VARIABLES=povcode
  /ORDER  ANALYSIS .

value labels povcode
1 'No livestock'
2 'up to 4 chicken'
3 'chicken and up to 1 goat'
4 'some goats and chicken'
5 'larger number of goats and chicken'
6 'up to 4 cattle and or other animals'
7 'more than 4 cattle and or other animals'.


RECODE
  poverty
  (0 thru 1=1)  (2 thru 9=2)  (9 thru 29=3)  (30 thru 99=4)
 (100 thru Highest= 5)  INTO  povcode1 .
VARIABLE LABELS povcode1 'Poverty code 5 categories'.
EXECUTE .

compute povcd1 = povcode1.

value labels povcode1
1 'No livestock'
2 'up to 4 chicken'
3 'small number of chicken and/or goats'
4 'larger number of chicken and/or goats'
5 'cattle and/or large number of goats and/or chicken'.

FREQUENCIES
  VARIABLES=povcode1
  /ORDER  ANALYSIS .

execute.

compute housing = houstype*100+ walls*10+ roof.
execute. 


compute housing1 = walls*10+ roof.
execute. 

if (housing1 = 0 or housing1 = 1 or housing1 = 30) housing1 = 99.
execute.

RECODE  housing1  (99=SYSMIS)  (12=22)  (11=11)  (21=21)  (22=22)  (31=31)  (32=32) .
EXECUTE .

***************************
 Recoding question g4 so that only the highest YES counts.

if ( pwm8wks = 1) pwu8wks = 3.
if ( pwm8wks = 1) pwu6wks = 3.
if ( pwm8wks = 1) pwu4wks = 3.
if ( pwm8wks = 1) pwu2wks = 3.


if ( pwu8wks = 1) pwu6wks = 3.
if ( pwu8wks = 1) pwu4wks = 3.
if ( pwu8wks = 1) pwu2wks = 3.

if ( pwu6wks = 1) pwu4wks = 3.
if ( pwu6wks = 1) pwu2wks = 3.

if ( pwu4wks = 1) pwu2wks = 3.

if (pwm8wks = 1) chitukuk = 6.
if (pwu8wks = 1) chitukuk = 5.
if (pwu6wks = 1) chitukuk = 4.
if (pwu4wks = 1) chitukuk = 3.
if (pwu2wks = 1) chitukuk = 2.
if (pwm8wks = 2 and pwu8wks = 2 and pwu6wks = 2 and pwu4wks = 2 and pwu2wks =2) chitukuk = 1.

variable labels chitukuk 'Number of weeks willing to do chitukuku for Starter Pack'.
value labels chitukuk
6 'more than 8 weeks'
5 'up to 8 weeks'
4 'up to 6 weeks'
3 'up to 4 weeks'
2 'up to 2 weeks'
1 'Not willing to work for SP'.

execute.

*********
Correcting C1 on the basis of the rest of the section.

compute test1 = chicken +doves +ducks+ rabbits+ g_fowls+ pigs+ sheep+ donkeys+ goats+ cattle+ oxen+  turkeys .
execute.

if (test1 >0) test2 = 1.
if (test1 = 0) test2 = 2.
execute.

* list quesno livstock test2.

compute livstock = test2.
execute.